//
//  TenMillionTool.m
//  FuncFanc
//
//  Created by careate-hubing on 2021/12/2.
//  Copyright © 2021 huhu. All rights reserved.
//

#import "TenMillionTool.h"

@implementation TenMillionTool
// 1.球池，随机排列 1-35个数的数组。
// 2.摇桨。从1-35 中随机抽出一个序号。去球池找对应的球。
// 3.球池删除刚才找出的球，然后继续摇奖。重复5次。摇出5个红球。
// 4.再按同样步骤摇出两个篮球。



+(NSArray *)getRandomRedBall
{
    NSMutableArray *redBallArr = [NSMutableArray array];
    for (int i = 0; i <= 4; i ++) {
        [redBallArr addObject:@([self getRedBall])];
    }
    
    NSMutableArray *blueBallArr = [NSMutableArray array];
    for (int i = 0; i < 2; i ++) {
        [blueBallArr addObject:@([self getBlueBall])];
    }
    NSArray *result = @[redBallArr,blueBallArr];
    return result;
}

+(int)getBlueBall
{
    int redBall = 0;
    for (int i = 1; i <= 12; i ++) {
        if (i == arc4random() % 12) {
            redBall = i;
        }
    }
    if (redBall == 0) {
        redBall = [self getBlueBall];
    }
    return redBall;
}



+(int)getRedBall
{
    int redBall = 0;
    for (int i = 1; i <= 35; i ++) {
        if (i == arc4random() % 35) {
            redBall = i;
        }
    }
    if (redBall == 0) {
        redBall = [self getRedBall];
    }
    return redBall;
}



@end
